using RuoVea.DynamicWebApi;
using RuoVea.ExSugar;
using RuoVea.ExSwagger;

namespace RuoVea.OmiApi.Reports.Test6
{
    public class Program
    {
        public static void Main(string[] args)
        {
            var builder = WebApplication.CreateBuilder(args);

            // Add services to the container.
            builder.Services.AddControllers();

            /*���ӳ��API���*/
            if (builder.Environment.IsProduction())
            {
                builder.Services.AddDynamicWebApi(options =>
                {
                    options.DefaultApiPrefix = "/openapi/api";
                    options.RemoveControllerPostfixes = new List<string> { "AppService", "Service" };
                    options.RemovePrefix = new List<string> { "get", "post" };
                });
            }
            else
            {
                builder.Services.AddDynamicWebApi(options =>
                {
                    options.RemoveControllerPostfixes = new List<string> { "AppService", "Service" };
                    options.RemovePrefix = new List<string> { "get", "post" };
                });
            }
            builder.Services.AddOmiReportSetup();
            builder.Services.AddSqlSugarSetup();
            
            builder.Services
                .AddSwaggerSetup()
                .AddReportInitSetup();

           var app = builder.Build();

            // Configure the HTTP request pipeline.

            app.UseSwaggerMiddle(builder.Environment);

            app.UseAuthorization();


            app.MapControllers();

            app.Run();
        }
    }
}
